<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();

require_once 'database/chat_handler.php';

if ($_GET['end'] == 1){
    $del = new chat_handler();

    $id = $_SESSION['gid'];

    $q_del = "DELETE FROM chat WHERE group_id='$id'";
    $q_del_g = "DELETE FROM group_members WHERE group_id='$id'";
    $q_del_gl = "DELETE FROM group_list WHERE group_id='$id'";
    $q_del_n = "DELETE FROM notification WHERE photo_id='$id'";
    $del->connect();
    mysql_query($q_del, $del->conn);
    mysql_query($q_del_g, $del->conn);
    mysql_query($q_del_gl, $del->conn);
    mysql_query($q_del_n, $del->conn);

    unset($_SESSION['people']);
    unset($_SESSION['gid']);

    mysql_close();
}

//udah ada grup id
$ch = new chat_handler();

if (isset($_SESSION['gid'])){
    $ch->retr_message_chat($_SESSION['gid']);
}
?>
<p>
    <?php
    for ($i=0; $i<count($ch->result[0]); $i++){
        echo "[". $ch->result[0][$i]. "] : ". $ch->result[1][$i]. "<br/>";
    }

    ?>
</p>